<template>
  <div style="display: flex;justify-content: center;align-items: center">
    <div>{{count}}</div>
    <a-button @click="addBtn">新增</a-button>
  </div>
</template>

<script>
import {ref, reactive, onMounted, computed} from 'vue'
import {testStore} from "@/store/composable"
import {storeToRefs} from "pinia"
export default {
  setup(props, context) {


    const store = testStore();
    // const {count} = store
    const count = computed(()=>{
      return store.getCount
    })
    // const {count} = storeToRefs(store)
    const addBtn = () => {
      // store.setCount()
      // store.$patch({
      //   count:count.value + 20
      // })

      store.$patch((state)=>{
        state.count = state.count + 20
      })
    }
    return {
      count,
      addBtn
    }
  }
}
</script>

<style scoped lang="scss">

</style>
